// pages/home/components/help/help.js
const app = getApp()

Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    funcList: [{
      help_id:'help_1',
        name: '电脑版',
        icon: 'pc',
        code: 'pc',
      },
      {
      help_id:'help_2',

        name: '公众号',
        icon: 'wechat',
        code: 'wechat',

      },
      {
      help_id:'help_3',

        name: '在线客服',
        icon: 'cus',
        code: 'cus',
        opentype: 'contact'
      },
      {
      help_id:'help_4',

        name: '客服电话',
        icon: 'phone',
        code: 'phone',

      },

    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    execFunc(e) {
      const {
        code
      } = e.currentTarget.dataset
      // 
      switch (code) {
        case 'phone':
          this.makeCallPhone()
          break;
        case 'wechat':
          this.makeWxmodal()
          break;
        case 'pc':
          this.showPCEnter()
          break;

        default:
          
          break;
      }
    },
    makeCallPhone() {
      wx.makePhoneCall({
        phoneNumber: "400-082-2298",
        success: function () {
          ;
        },
        fail: function () {
          ;
        },
      });
    },
    makeWxmodal() {
      const wxBannerUrl = 'https://mp.weixin.qq.com/s/AvG0eHd6mNgndreFgWzryQ'
      // this.selectComponent('#wx-modal').showCopyClick()
      wx.navigateTo({
        url: '/pages/index/bannerLink/bannerLink?banner=' + wxBannerUrl,
      });
    },
    showPCEnter() {
      const showDialog = this.selectComponent("#showDialog")
      showDialog ? showDialog.display() : '';
    },
  }
})